package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TextNote {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt");
        System.out.println("请开始输入!单独输入exit将退出");
        while (true){
            String line = scan.nextLine();
            if (line.equals("exit")){
                System.out.println("写出完毕!退出操作!");
                break;
            }
            fos.write(line.getBytes(StandardCharsets.UTF_8));//将输入的内容写入文件中
        }
        System.out.println("结束了");
        fos.close();
    }
}
